#include "strategy.h"
#include "move.h"
#include "timer.h"
#include "sensor.h"
#include "main.h"

void line_step(void)
{
 	unsigned short x = getX();
	unsigned short y = getY();
	unsigned short angle = get_robot_heading();
	
	unsigned short left = 0;
  unsigned short front = 0;
	unsigned short right = 0;
	get_scanner_stats(&left, &front, &right);
	if(front<100)
  	  rotate(200);
	
	if(x<=30||x>=990||y<=30||y>=990)
	{
	   h_step_backward();
	   wait(MOVEWAIT);
	   rotate(300);
	   h_step_forward();
	   wait(MOVEWAIT);
	}
	else
	{
    h_step_forward();
	  wait(MOVEWAIT);	
	}
}

void evade_step(void)
{
  
}

void search_and_destroy(void)
{
    unsigned short left = 0;
  	unsigned short front = 0;
	  unsigned short right = 0;
	  unsigned short health = 0;
		
		set_sensor_angle(TEN);
		
	  get_scanner_stats(&left, &front, &right);
	  //health = get_health();
	  
	  if(front<1000)
	  {
	    set_turret_pos(PTP*4);
	    //get_scanner_stats(&left, &front, &right);
	    fire_turret(front);
	  }
	  if(front<100)
  	  rotate(300);
	  mode = FIND;
}

void go_to_health(void)
{
}
